<template>
  <div class="container">
    <mi-header :backIconShow="false" :cartIconShow="true">小米手机</mi-header>
    <phone-list></phone-list>
  </div>
</template>

<script>
import getData from "../services/index";

import MiHeader from "../components/Header/index.vue";
import PhoneList from "../components/PhoneList/index.vue";

export default {
  name: "HomePage",
  components: {
    MiHeader,
    PhoneList,
  },
  mounted() {
    //请求后端数据
    getData();

    //派发执行state,同步localStorage里的数据到state数据里
    this.$store.dispatch("setData");
  },
};
</script>
